<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.

define('CACHE_TIME', 30 * 60);
define('PAGE_LIMIT', 10);
define('DEFAULT_META_KEYWORDS', 'Meme keywords');
define('DEFAULT_META_DESCRIPTION', 'Meme description');

return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
    'name' => MEME_APP_NAME,
    // preloading 'log' component
    'preload' => array('log'),
    // autoloading model and component classes
    'import' => array(
        'application.models.*',
        'application.models.configs.*',
        'application.models.settings.*',
        'application.components.*',
        'application.extensions.*',
        'application.extensions.plugins.*',
        'application.extensions.yii-mail.*',
    ),
    'modules' => array(
        'admin',
//        'gii' => array(
//            'class' => 'system.gii.GiiModule',
//            'password' => 'admin',
//            // If removed, Gii defaults to localhost only. Edit carefully to taste.
//            'ipFilters' => array('127.0.0.1', '::1'),
//        ),
    ),
    // application components
    'components' => array(
        /* config to use cache */
        'cache'=>array(
            'class'=>'system.caching.CFileCache',
        ),
        /* end config to use cache */
        'plugin' => array(
            'class' => 'application.components.PluginSystem',
        ),
        'thumb' => array(
            'class' => 'ext.yii-image.Thumbnailer',
            'wideImagePath' => 'wideimage-11.02.19-lib',
            'width' => 150,
            'height' => 150,
        ),
        'coreMessages'=>array(
            'basePath'=>null,
        ),
        'user' => array(
            // enable cookie-based authentication
            'allowAutoLogin' => true,
            'class' => 'WebUser',
        ),
        'format'=>array(
            'class'=>'ext.yii-timeago.TimeagoFormatter',
        ),
        'mail' => array(
            'class' => 'ext.yii-mail.YiiMail',
            'transportType' => 'php',
            // folder in themes views
            'viewPath' => 'email-templates',
            'logging' => true,
            'dryRun' => false
        ),
        // uncomment the following to enable URLs in path-format
        'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => false,
            'rules' => array(
                '<action:(latest|popular|trending|featured|video)>'=>'site/index',
                '<action:(latest|popular|trending|featured|video)>/<page:\d+>'=>'site/index',
                'meme/<id:\d+>'=>'site/index',
                'page/<page:\d+>'=>'site/index',
                'static/<slug:[a-zA-Z0-9-_]+>'=>'site/cms',
                'my-memes'=>'site/mymemes',
                'admin/login'=>'admin/account/login',
                'admin/logout'=>'admin/account/logout',
//                'admin'=>'admin/account/index',
                'generate'=>'generate/index',
                '<profile:[a-zA-Z0-9._]+>'=>'site/profile',
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            ),
        ),
        'db' => array(
            'connectionString' => 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME,
            'emulatePrepare' => true,
            'username' => DB_USER,
            'password' => DB_PASSWORD,
            'charset' => 'utf8',
        ),
        'errorHandler' => array(
            // use 'site/error' action to display errors
            'errorAction' => 'site/error',
        ),
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute',
                    'levels' => 'error, warning',
                ),
            // uncomment the following to show log messages on web pages
            /*
              array(
              'class'=>'CWebLogRoute',
              ),
             */
            ),
        ),
    ),
    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params' => array(
        // this is used in contact page
        'salt' => '*92))!-+.',
        'adminEmail' => ADMIN_EMAIL,
        'upload_dir' => 'uploads',
        'avatar_dir' => 'avatars',
        'hauth' => array(
            'allowedProviders' => array(),
            'config' => array(
                "base_url" => "http://example.com/site/socialLogin",
                "providers" => array(
                    "Google" => array(
                        "enabled" => true,
                        "keys" => array(
                            "id" => "",
                            "secret" => "",
                        ),
                        "scope" => "https://www.googleapis.com/auth/userinfo.profile " . "https://www.googleapis.com/auth/userinfo.email",
                        "access_type" => "online",
                    ),
                    "Facebook" => array(
                        "enabled" => true,
                        "keys" => array(
                            "id" => "",
                            "secret" => "",
                        ),
                        "scope" => "email"
                    ),
                    "Live" => array(
                        "enabled" => true,
                        "keys" => array(
                            "id" => "windows client id",
                            "secret" => "Windows Live secret",
                        ),
                        "scope" => "email"
                    ),
                    "Yahoo" => array(
                        "enabled" => true,
                        "keys" => array(
                            "key" => "yahoo client id",
                            "secret" => "yahoo secret",
                        ),
                    ),
                    "LinkedIn" => array(
                        "enabled" => true,
                        "keys" => array(
                            "key" => "linkedin client id",
                            "secret" => "linkedin secret",
                        ),
                    ),
                    "Twitter" => array(// 'key' is your twitter application consumer key
                        "enabled" => true,
                        "username" => '',
                        "keys" => array(
                            "key" => "",
                            "secret" => ""
                        ),
                    ),
                ),
                "debug_mode" => false,
                // to enable logging, set 'debug_mode' to true, then provide here a path of a writable file 
                "debug_file" => "",
            ),
        ),
        'version' => '2.18'
    ),
    'theme' => 'classic',
    'sourceLanguage'=> 'en_US',
    'language' => 'en_US',
);